<template>
  <a-select
    v-model="formModel"
    allow-clear
    placeholder="请选择"
    :multiple="multiple"
  >
    <a-option
      v-for="item of userSelectData"
      :key="item.userId"
      :value="item.userId"
      :tag-props="{color: 'blue'}"
    >
      {{ item.userName }}
    </a-option>
  </a-select>
</template>

<script lang="ts" setup>
import { ref, defineModel, onMounted } from 'vue';
import { selectUser, SysUser } from '@/api/system/user';

const props = defineProps({
  multiple: {
    type: Boolean,
    default: () => {
      return true;
    }
  }
});

const formModel = defineModel({ type: Array || String });

const userSelectData = ref<SysUser[]>([]);

onMounted(() => {
  selectUser().then(res => {
    userSelectData.value = res.data;
  });
});
</script>

<script lang="ts">
export default {
  name: 'BusinessUserSelect'
};
</script>

<style scoped lang="less">

</style>